/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Objects;

import Tools.Tools;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author MITM
 */
public class Supplier {
    private int idSupplier;
    private String rif;
    private int rif_val;
    private GroupSupplier groupsupplier;
    private String nombre;
    private String rlegal;     
    private City city;
    private Parish parish;
    private Municipality municipality;
    private State state;
    private Country country;
    private String direccion;
    private String telefonos;
    private String fax;
    private String correo;
    private String contacto;
    private String celular;
    private int status;     

    /**
     * 
     */
    public Supplier(){
        
    }

    /**
     * 
     * @param rs 
     */
    public Supplier(ResultSet rs){
        try{
            //Datos del Proveedor
            idSupplier      = rs.getInt(1);
            rif             = rs.getString(2);
            rif_val         = rs.getInt(3);
            
//            //Datos GroupSupplier del Cliente
            GroupSupplier objGs = new GroupSupplier();
            objGs.setIdGroupSupplier(rs.getInt(4));
            objGs.setNombre(rs.getString(5));
//            objGs.setAbrev(null);
            groupsupplier = objGs;

            nombre          = rs.getString(6);
            rlegal          = rs.getString(7);

//            //Datos City del Cliente
            City objCi = new City();
            objCi.setIdPoblacion(rs.getInt(8));
            objCi.setNombre(rs.getString(9));
//            objCi.setAbrev(null);
//            objCi.setIdTipo(null);
//            objCi.setIdPoblacionp(0);
            city = objCi;

            //Datos Parish del Cliente
            Parish objPa = new Parish();
            objPa.setIdPoblacion(rs.getInt(10));
            objPa.setNombre(rs.getString(11));
//            objPa.setAbrev(null);
//            objPa.setIdTipo(null);
//            objPa.setIdPoblacionp(0);
            parish = objPa;

            //Datos Municipality del Cliente
            Municipality objMu = new Municipality();
            objMu.setIdPoblacion(rs.getInt(12));
            objMu.setNombre(rs.getString(13));
//            objMu.setAbrev(null);
//            objMu.setIdTipo(null);
//            objMu.setIdPoblacionp(0);
            municipality = objMu;

            //Datos State del Cliente
            State objSt = new State();
            objSt.setIdPoblacion(rs.getInt(14));
            objSt.setNombre(rs.getString(15));
//            objSt.setAbrev(null);
//            objSt.setIdTipo(null);
//            objSt.setIdPoblacionp(0);
            state = objSt;

            //Datos Country del Cliente
            Country objCo = new Country();
            objCo.setIdPoblacion(rs.getInt(16));
            objCo.setNombre(rs.getString(17));
//            objCo.setAbrev(null);
//            objCo.setIdTipo(null);
//            objCo.setIdPoblacionp(0);
            country = objCo;

            direccion       = rs.getString(18);
            telefonos       = rs.getString(19);
            fax             = rs.getString(20);
            correo          = rs.getString(21);
            contacto        = rs.getString(22);
            celular         = rs.getString(23);
            status          = rs.getInt(24);
                    
        }catch(SQLException e){
            Tools.getErrorMessage(e.getStackTrace(),e.getMessage());
        }
    }

    /**
     * @return the idSupplier
     */
    public int getIdSupplier() {
        return idSupplier;
    }

    /**
     * @param idSupplier the idSupplier to set
     */
    public void setIdSupplier(int idSupplier) {
        this.idSupplier = idSupplier;
    }

    /**
     * @return the rif
     */
    public String getRif() {
        return rif;
    }

    /**
     * @param rif the rif to set
     */
    public void setRif(String rif) {
        this.rif = rif;
    }

    /**
     * @return the rif_val
     */
    public int getRif_val() {
        return rif_val;
    }

    /**
     * @param rif_val the rif_val to set
     */
    public void setRif_val(int rif_val) {
        this.rif_val = rif_val;
    }

    /**
     * @return the nombre
     */
    public String getNombre() {
        return nombre;
    }

    /**
     * @param nombre the nombre to set
     */
    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    /**
     * @return the rlegal
     */
    public String getRlegal() {
        return rlegal;
    }

    /**
     * @param rlegal the rlegal to set
     */
    public void setRlegal(String rlegal) {
        this.rlegal = rlegal;
    }

    /**
     * @return the direccion
     */
    public String getDireccion() {
        return direccion;
    }

    /**
     * @param direccion the direccion to set
     */
    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    /**
     * @return the telefonos
     */
    public String getTelefonos() {
        return telefonos;
    }

    /**
     * @param telefonos the telefonos to set
     */
    public void setTelefonos(String telefonos) {
        this.telefonos = telefonos;
    }

    /**
     * @return the fax
     */
    public String getFax() {
        return fax;
    }

    /**
     * @param fax the fax to set
     */
    public void setFax(String fax) {
        this.fax = fax;
    }

    /**
     * @return the correo
     */
    public String getCorreo() {
        return correo;
    }

    /**
     * @param correo the correo to set
     */
    public void setCorreo(String correo) {
        this.correo = correo;
    }

    /**
     * @return the contacto
     */
    public String getContacto() {
        return contacto;
    }

    /**
     * @param contacto the contacto to set
     */
    public void setContacto(String contacto) {
        this.contacto = contacto;
    }

    /**
     * @return the celular
     */
    public String getCelular() {
        return celular;
    }

    /**
     * @param celular the celular to set
     */
    public void setCelular(String celular) {
        this.celular = celular;
    }

    /**
     * @return the status
     */
    public int getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(int status) {
        this.status = status;
    }
    
    /**
     * @return the city
     */
    public City getCity() {
        return city;
    }

    /**
     * @param city the city to set
     */
    public void setCity(City _city) {
        this.city = _city;
    }

    /**
     * @return the parish
     */
    public Parish getParish() {
        return parish;
    }

    /**
     * @param parish the parish to set
     */
    public void setParish(Parish _parish) {
        this.parish = _parish;
    }

    /**
     * @return the municipality
     */
    public Municipality getMunicipality() {
        return municipality;
    }

    /**
     * @param municipality the municipality to set
     */
    public void setMunicipality(Municipality _municipality) {
        this.municipality = _municipality;
    }

    /**
     * @return the state
     */
    public State getState() {
        return state;
    }

    /**
     * @param state the state to set
     */
    public void setState(State _state) {
        this.state = _state;
    }

    /**
     * @return the country
     */
    public Country getCountry() {
        return country;
    }

    /**
     * @param country the country to set
     */
    public void setCountry(Country _country) {
        this.country = _country;
    }

    /**
     * @return the groupsupplier
     */
    public GroupSupplier getGroupsupplier() {
        return groupsupplier;
    }

    /**
     * @param groupsupplier the groupsupplier to set
     */
    public void setGroupsupplier(GroupSupplier _groupsupplier) {
        this.groupsupplier = _groupsupplier;
    }

    /**
     * 
     * @return 
     */
    @Override
    public String toString(){
        return this.getNombre();
    }

}
